home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / GRAPHICS / VOXRAY.ZIP / SPRUTILS.H < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-10  |  1.5 KB  |  73 lines

  1. #ifndef _SPRUTILS_
  2. #define _SPRUTILS_
  3. #include "ray.h"
  4. #include "globals.h"
  5.  
  6. #define BAD_LOAD_OFFSET -1
  7.  
  8. inline sector * Get_Sec_From_SSec(ssector * cur_ss)
  9. {
  10.    seg * cur_seg=Seg_List+cur_ss->seg_start;
  11.    return (cur_seg->ld->s[(short)cur_seg->left_sidedef]->sec);
  12. }
  13.  
  14. inline long Sprite_Y(pobject_node the_obj)
  15. {
  16.    return (the_obj->data->ty);
  17. }
  18.  
  19. inline BOOL OL_Empty_Node(pobject_node the_node)
  20. {
  21. return ( (the_node==NULL) ? TRUE : FALSE);
  22. }
  23.  
  24. inline pobject_node OL_Next_Node(pobject_node cur_node)
  25. {
  26. return cur_node->front;
  27. }
  28.  
  29. inline void OL_Swap_SS_Nodes(pobject_node swap1, pobject_node swap2)
  30. {
  31.    pobject data1, data2;
  32.    data1=swap1->data;
  33.    data2=swap2->data;
  34.    swap1->data=data2;
  35.    swap2->data=data1;
  36.  
  37.    if (data1->ss_node==swap1)
  38.       data1->ss_node=swap2;
  39.    else if (data1->global_node==swap1)
  40.       data1->global_node=swap2;
  41.  
  42.    if (data2->ss_node==swap2)
  43.       data2->ss_node=swap1;
  44.    else if (data2->global_node==swap2)
  45.       data2->global_node=swap1;
  46.  
  47. }
  48.  
  49. inline void OL_Delete_Node(pobject_node delete_node, pobject_node & list)
  50. {
  51. if (list==delete_node)
  52.    list=list->front;
  53. else {
  54.    pobject_node d_front, d_back;
  55.    d_front=delete_node->front;
  56.    d_back=delete_node->back;
  57.    d_back->front=d_front;
  58.    if (d_front!=NULL)
  59.       d_front->back=d_back;
  60. }
  61. }
  62.  
  63. inline void OL_Push_Node(pobject_node push_node, pobject_node & list)
  64. {
  65. push_node->back=NULL;
  66. push_node->front=list;
  67. if (list!=NULL)
  68.    list->back=push_node;
  69. list=push_node;
  70. }
  71.  
  72. #endif
  73.